package com.yunsom.testdemo.design.watcher;

/**
 * @author Xbao
 * @version 1.0
 * @description 观察者模式
 * @date 2021/3/22 20:08
 */
public class WatcherTest {

  public static void main(String[] args) {
    Subject subject = new Subject();

    new HexaAbstractObserver(subject);
    new OctalAbstractObserver(subject);
    new BinaryAbstractObserver(subject);

    System.out.println("first state change:");
    subject.setState(15);
    subject.notifyAllObservers();

    System.out.println("second state change:");
    subject.setState(10);
    subject.notifyAllObservers();
  }
}
